/*#include <UnitTest++.h>

//#include "game_systems.h"
#include "StompedReality/Asset/AnimationManager.h"
#include "StompedReality/Asset/AnimationManager.h"
#include "StompedReality/Asset/JointAnimation.h"
#include "StompedReality/Asset/JointAnimationPlayer.h"
#include "StompedReality/Core/Game.h"
#ifdef LINUX
#include "StompedReality/Core/Graphics/LinuxRenderSystem.h"
#elif WIN32
#include "StompedReality/Core/Graphics/Windows/WGLRenderSystem.h"
#endif
#include "StompedReality/Core/Memory/ObjectPoolManager.h"
#include "StompedReality/Core/TypeSystem/TypeSystem.h"

using namespace StompedReality;
using namespace StompedReality::Core;
using namespace StompedReality::components;
using namespace StompedReality::animation;
SUITE ( Animation_Test )
{
  TEST ( Joint_Animation_Json_Test )
  {
    StompedReality::type_system::TypeInfo* jointAnimType =
      StompedReality::type_system::TypeSystem::GetType<StompedReality::animation::JointAnimation>( );

    std::cout << jointAnimType->to_s( ) << std::endl;

    StompedReality::animation::JointAnimation anim;
    KeyFrame frameA;
    frameA.setDuration ( 0.5f );
    frameA.SetRotation ( 10.0f );
    KeyFrame frameB;
    frameB.setDuration ( 0.5f );
    frameB.SetRotation ( -10.0f );
    anim.addKeyFrame ( frameA );
    anim.addKeyFrame ( frameB );
    Json::Value root;
    jointAnimType->write ( root, ( char* ) &anim );

    //std::cout << root << std::endl;

    JointAnimation animB;
    jointAnimType->read ( root, ( char* ) &animB );
    CHECK_CLOSE ( anim.getKeyFrame ( 0 )->getDuration( ), animB.getKeyFrame ( 0 )->getDuration( ), 0.0001 );
    CHECK_CLOSE ( anim.getKeyFrame ( 0 )->GetRotation( ), animB.getKeyFrame ( 0 )->GetRotation( ), 0.0001 );
    CHECK_CLOSE ( anim.getKeyFrame ( 1 )->getDuration( ), animB.getKeyFrame ( 1 )->getDuration( ), 0.0001 );
    CHECK_CLOSE ( anim.getKeyFrame ( 1 )->GetRotation( ), animB.getKeyFrame ( 1 )->GetRotation( ), 0.0001 );
  }
  TEST ( Joint_Animation_Find_Joint_Test )
  {
    Game game;

#ifdef LINUX
    game.setRenderer( new StompedReality::Graphics::LinuxRenderSystem( ));
#elif WIN32
    game.setRenderer( new StompedReality::Graphics::WGLRenderSystem( ));
#endif
    game.ParseConfig( "Content-StompedRealityUnitTest/gs_test.json" );

    // get type info
    StompedReality::type_system::TypeInfo* jointComponentType =
      StompedReality::type_system::TypeSystem::GetType<JointComponent>( );

    // init memory block
    game.getComponentSystem( )->AddObjectPool ( jointComponentType->typeID,
                                                ( StompedReality::Core::MemoryBlock<StompedReality::Core::Component>* )
                                                StompedReality::Core::ObjectPool<JointComponent>::CreateObjectPool ( 5 ) );

    // create joints
    ID jointAID = game.getComponentSystem( )->CreateObject ( jointComponentType->typeID );
    JointComponent* jointA = ( JointComponent* )
      game.getComponentSystem( )->GetObject ( jointComponentType->typeID, jointAID );
    ID jointBID = game.getComponentSystem( )->CreateObject ( jointComponentType->typeID );
    JointComponent* jointB = ( JointComponent* )
      game.getComponentSystem( )->GetObject ( jointComponentType->typeID, jointBID );

    // create frames
    KeyFrame frameA;
    frameA.setDuration ( 0.5f );
    frameA.SetRotation ( 10.0f );
    KeyFrame frameB;
    frameB.setDuration ( 0.5f );
    frameB.SetRotation ( -10.0f );

    // create anim test
    StompedReality::animation::JointAnimation animFrames;
    animFrames.addKeyFrame ( frameA );
    animFrames.addKeyFrame ( frameB );

    // no loop
    StompedReality::animation::JointAnimationPlayer anim;
    anim.setAnimation( &animFrames );
    anim.start( );
    CHECK_EQUAL ( 0, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 10.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0.0, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( -10.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.5 );
    CHECK_EQUAL ( false, anim.isPlaying( ) );

    // loop
    anim.playAsLoop ( true );
    anim.start( );
    CHECK_EQUAL ( 0, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 10.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0.0, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( -10.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 10.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim.getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim.isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim.calculateRotation( ), 0.0001 );
    anim.updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim.getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim.getFrameTime( ), 0.0001 );
    CHECK_CLOSE ( -10.0f, anim.calculateRotation( ), 0.0001 );
  }
  TEST ( Anim_Manager_Test )
  {
    AnimationManager mngr;
    mngr.Initialize( 10 );
    mngr.ReadFromFile( "Content-StompedRealityUnitTest/test_animations.json" );
    JointAnimation* animFrames = mngr.getJointAnimation( 0 );
    JointAnimationPlayer* anim = new JointAnimationPlayer( );
    anim->setAnimation( animFrames );
    anim->playAsLoop( true );
    anim->start( );

    // loop
    CHECK_EQUAL ( 0, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim->getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim->isPlaying( ) );
    CHECK_CLOSE ( 10.0f, anim->calculateRotation( ), 0.0001 );
    anim->updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim->getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim->isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim->calculateRotation( ), 0.0001 );
    anim->updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0.0, anim->getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim->isPlaying( ) );
    CHECK_CLOSE ( -10.0f, anim->calculateRotation( ), 0.0001 );
    anim->updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim->getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim->isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim->calculateRotation( ), 0.0001 );
    anim->updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim->getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim->isPlaying( ) );
    CHECK_CLOSE ( 10.0f, anim->calculateRotation( ), 0.0001 );
    anim->updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 0, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0.25, anim->getFrameTime( ), 0.0001 );
    CHECK_EQUAL ( true, anim->isPlaying( ) );
    CHECK_CLOSE ( 0.0f, anim->calculateRotation( ), 0.0001 );
    anim->updateFrameTime ( 0.25 );
    CHECK_EQUAL ( 1, anim->getCurrentIndex( ) );
    CHECK_CLOSE ( 0, anim->getFrameTime( ), 0.0001 );
    CHECK_CLOSE ( -10.0f, anim->calculateRotation( ), 0.0001 );
  }
}*/